<!-- 余额明细 -->
<template>
	<view class="content page">
		<back-top v-if='showTop'></back-top>
		<status-bar :title='nameDefinition.balanceTitle?nameDefinition.balanceTitle+"明细":"余额明细"'></status-bar>
		<view v-if="pageData && pageData.length > 0">
			<view class="item_list" v-for="(item,index) in pageData" :key="index">
				<view class="list_info">
					<view class="info_box">
						<view class="info_title">{{item.title}}</view>
						<view class="info_time">{{item.addDate}}</view>
					</view>
					<view class="info_box infoboxt">
						<text v-if='item.status == 0' class="error-color"><text>-</text> {{item.money}}</text>
						<text v-if='item.status == 1' class="success-color"><text>+</text>{{item.money}}</text>
					</view>
				</view>
			</view>
			<view class="DiLine" v-if='!more'>---- 我也是有底线的  -----</view>
		</view>
		<view v-else>
			<empty type='1' cat='3' msg='暂无相关记录 !'></empty>
		</view>
	</view>
</template>

<script>
	var that;
	export default{
		data(){
			return{
				showTop: false,
				
				color: getApp().globalData.color,
				
				vid: '',
				pageData: [],
				page:1,
				pageSize:15,
				more: false,
				nameDefinition: uni.getStorageSync('startUp').nameDefinition,
			}
		},
		onShow() {
			uni.setNavigationBarTitle({
				title: this.nameDefinition.balanceTitle?this.nameDefinition.balanceTitle+"明细":"余额明细"
			})
		},
		onShareAppMessage(option) {			
			let shareData = uni.getStorageSync('shareData');
			return {
				title: shareData.title,
				desc: shareData.desc,
				path: '/pages/index/index?share_v_id=' + that.vid,
				imageUrl: shareData.imageUrl
			}		},
		onLoad() {
			that = this
			that.vid = uni.getStorageSync("vid")
			that.getpageData()
			// #ifdef H5
			this.H5Share()
			// #endif
		},
		onReachBottom(e) {
			if(that.more){
				that.getpageData()
			}
		},
		methods:{
			getpageData(){
				that.more = false
				that.$http.post({
					url: '/SRA_memberRecharge/moneyRecord',
					data: {
						VeriCode: uni.getStorageSync('bid'),
						vId: that.vid,
						Y: '',
						M: '',
						pageIndex: that.page,
						pageSize: that.pageSize,
					}
				}).then(res => {
					if(res.code == 100){
						if(res.data){
							that.pageData = that.pageData.concat(res.data)
							if(res.data.length >= that.pageSize){
								that.more = true
								that.page += 1
							}
						}
					}	
					uni.hideLoading()
				})
			}
		},
		onPageScroll(e) {
			if(e.scrollTop > 333){
				that.showTop = true
			}else{
				that.showTop = false
			}
		}
	}
</script>

<style scoped lang="scss">
	.content{width: 100%;font-size: 28upx;color: #333333;min-height: 101vh;}
	.item_list{width: 100%;border-bottom: 1px solid #F4F4F4;}
	.list_info{width: 100%;background: #FFFFFF;padding: 30upx;display: flex;justify-content: space-between;flex-direction: row;flex-wrap: nowrap;}
	.info_box{width: 50%;height: 70upx;}
	.info_title{font-size: 32upx;}
	.info_time{color: #8A8A8A;font-size: 24upx;}
	.info_money{font-size: 40upx;color: #F86375;}
	.infoboxt{
		text-align: right;
		line-height: 70upx;
		text{
			font-size: 36rpx;
			margin-right: 4rpx;
			text{
				font-size: 40rpx;
				font-weight: bold;
			}
			
		}
	}
	.nolist{text-align: center;color: #8A8A8A;line-height: 100upx;}
</style>
